package tech.xs.sys.domain.bo.web.menu;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import tech.xs.common.framework.domain.bo.PageBo;
import tech.xs.common.framework.domain.entity.BaseEntity;
import tech.xs.sys.domain.entity.SysWebMenu;

import java.util.List;

@Getter
@Setter
@ToString
public class PageWebMenuBo extends PageBo<SysWebMenu> {

    private String likeCode;

    private String likeName;

    private String likePageUri;

    private String likeFatherCode;

    public LambdaQueryWrapper<SysWebMenu> query() {
        return Wrappers.<SysWebMenu>lambdaQuery()
                .like(StrUtil.isNotBlank(likeCode), SysWebMenu::getCode, likeCode)
                .like(StrUtil.isNotBlank(likeName), SysWebMenu::getName, likeName)
                .like(StrUtil.isNotBlank(likePageUri), SysWebMenu::getPageUri, likePageUri)
                .like(StrUtil.isNotBlank(likeFatherCode), SysWebMenu::getFatherCode, likeFatherCode)
                .orderByAsc(SysWebMenu::getOrderValue);
    }
}
